package cn.edu.ujn.shi.service;

import cn.edu.ujn.shi.dao.Complain;
import cn.edu.ujn.shi.dao.ComplainMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 投诉表 服务实现类
 *
 * @author LiChao
 * @since 2024-05-31
 */
@Service
public class ComplainServiceImpl implements IComplainService {

    @Autowired
    private ComplainMapper complainMapper;

    @Override
    public List<Complain> getComplain(String username) {
        return complainMapper.getComplain(username);
    }

    @Override
    public List<Complain> getAll() {
        return complainMapper.getAll();
    }

    @Override
    public void insert(Complain loginLog) {
        complainMapper.insert(loginLog);
    }

    @Override
    public void delete(int id) {
        complainMapper.delete(id);
    }

    @Override
    public Complain getComplainById(String id) {
        return complainMapper.getComplainById(id);
    }

    @Override
    public void updateComplain(Complain complain) {
        complainMapper.updateComplain(complain);
    }

    @Override
    public List<Complain> getComplainLike(String complainant) {
        if (complainant == null) complainant = "";
        return complainMapper.getComplainLike(complainant);
    }
}
